package com.preknow.oop;

/**
 * 方法的返回值类型以及参数
 * 1.返回值类型可以是类类型
 * 2.参数可以传对象
 */
public class MethonDemo {
    public void Method1(Student s){
        System.out.println(s.getName()+"------"+s.getAge());
    }


    public Student method2(){
        Student s1 = new Student();
        s1.setName("friend");
        s1.setAge(20);
        return s1;
    }


    public static void main(String[] args) {
        MethonDemo methonDemo = new MethonDemo();
        Student student = methonDemo.method2();
        System.out.println(student.getName()+"------"+student.getAge());


        Student s1 = new Student();
        s1.setName("friend");
        s1.setAge(30);
        methonDemo.Method1(s1);
    }

}
